<template>
	<view class="myldz">
		<u-navbar bgColor="#fff">
			<view slot="left" class="align-center">
				<image @click="$tools.back()" src="@/static/login/back3.png" style="width: 36rpx; height: 36rpx"></image>
			</view>
			<view slot="center">
				<view style="font-weight: 600; font-size: 36rpx; color: #333333">添加简历</view>
			</view>
		</u-navbar>
		<view class="">
			<view class="flex" style="margin-bottom: 25rpx; padding: 0 32rpx">
				<view style="margin-right: 20rpx">
					<image :src="obj.projectImg" style="width: 84rpx; height: 84rpx"></image>
				</view>
				<view class="flex-column flex-between">
					<view class="align-center">
						<view style="font-weight: 600; font-size: 28rpx; color: #333333; margin-right: 20rpx">{{ obj.jobName }}</view>
						<view
							v-if="obj.status == 0"
							class="flex-center1"
							style="width: 104rpx; height: 40rpx; background: #ffffff; border-radius: 8rpx; border: 1rpx solid #f9850b; font-size: 24rpx; color: #f9850b"
						>
							正在招
						</view>
						<view
							v-if="obj.status == 1"
							class="flex-center1"
							style="font-size: 24rpx; color: #999999; width: 104rpx; height: 40rpx; background: #ffffff; border-radius: 8rpx; border: 1rpx solid #999999"
						>
							已招满
						</view>
					</view>
					<view style="font-weight: 300; font-size: 24rpx; color: #333333">
						<text>{{ obj.companyName }} · 预招{{ obj.total }}人 · {{ obj.salaryStart }}-{{ obj.salaryEnd }}</text>
					</view>
				</view>
			</view>
		</view>
		<!-- <view class="flex-between1" style="background: #f5f6fa; padding: 32rpx">
			<view class="align-center">
				<view class="text1" style="margin-right: 40rpx">查看</view>
				<view class="text2" style="margin-right: 40rpx">电话</view>
				<view class="text2">已报名</view>
			</view>
			<view class="align-center" style="background: #edf2f9; border-radius: 4rpx; padding: 8rpx 18rpx">
				<text style="margin-right: 20rpx">筛选</text>
				<image src="@/static/index/bottom@2x.png" style="width: 22rpx; height: 14rpx"></image>
			</view>
		</view> -->
		<view class="align-center" style="background: #f5f6fa; padding: 32rpx 32rpx 0">
			<!-- <view class="text2" style="margin-right: 40rpx">公司简历池</view> -->
			<view class="text1">我的简历池</view>
		</view>
		<view style="background: #f5f6fa; padding: 20rpx 32rpx; min-height: 100vh">
			<view class="flex" v-for="(item, index) in list" :key="index" style="padding: 20rpx; background-color: #fff; margin-bottom: 20rpx">
				<view style="margin-right: 28rpx"></view>
				<view style="flex: 1">
					<view class="flex-between1">
						<view class="align-center">
							<view style="margin-right: 20rpx">
								<image :src="item.userInfo.head" style="width: 84rpx; height: 84rpx"></image>
							</view>
							<view class="align-center">
								<view style="font-weight: 600; font-size: 32rpx; color: #333333">{{ item.userInfo.name }}</view>
								<view @click.stop.native="$tools.navigite('../index/jianli', 1, item.userId)">
									<u-icon name="file-text" color="#1365F9" size="44"></u-icon>
								</view>
							</view>
						</view>
						<view class="align-center">
							<view
								@click="$tools.playphone(item.userInfo.phone)"
								class="flex-center1"
								style="margin-right: 20rpx; width: 56rpx; height: 56rpx; background: #1365f9; border-radius: 8rpx"
							>
								<u-icon name="phone-fill" color="#fff" size="40"></u-icon>
							</view>
							<view
								v-if="item.status == 0"
								@click="addPostUser(item.id)"
								class="flex-center1"
								style="width: 140rpx; height: 56rpx; background: #1365f9; border-radius: 8rpx; font-size: 24rpx; color: #ffffff"
							>
								添加到项目
							</view>
						</view>
					</view>
					<view style="font-weight: 300; font-size: 24rpx; color: #999999; padding: 14rpx 0">{{ item.userInfo.sex == 1 ? '男' : '女' }} | {{ item.userInfo.age }}岁</view>
					<view class="flex-wrap">
						<view style="margin: 0 20rpx 20rpx 0; padding: 8rpx 20rpx; font-weight: 400; background: #f8f8f8; border-radius: 8rpx; font-size: 24rpx; color: #666666">
							{{ item.userInfo.workIntention }}
						</view>
						<view style="margin: 0 20rpx 20rpx 0; padding: 8rpx 20rpx; font-weight: 400; background: #f8f8f8; border-radius: 8rpx; font-size: 24rpx; color: #666666">
							{{ item.userInfo.income }}
						</view>
						<view style="margin: 0 20rpx 20rpx 0; padding: 8rpx 20rpx; font-weight: 400; background: #f8f8f8; border-radius: 8rpx; font-size: 24rpx; color: #666666">
							{{ item.userInfo.workTime }}
						</view>
						<view style="margin: 0 20rpx 20rpx 0; padding: 8rpx 20rpx; font-weight: 400; background: #f8f8f8; border-radius: 8rpx; font-size: 24rpx; color: #666666">
							{{ item.userInfo.workAddress }}
						</view>
					</view>
					<view style="font-weight: 400; font-size: 24rpx; color: #333333">{{ item.userInfo.remark }}</view>
				</view>
			</view>
			<view v-if="!list.length" style="text-align: center; padding-top: 100rpx">暂无人员数据~</view>
		</view>
		<u-popup :show="show" @close="close" round="40">
			<view style="padding: 32rpx">
				<view style="font-weight: 600; font-size: 32rpx; color: #333333; margin-bottom: 50rpx">我想要</view>
				<view style="margin-bottom: 50rpx">
					<u-radio-group v-model="radiovalue1" placement="column" @change="groupChange" size="40">
						<u-radio
							:customStyle="{ marginBottom: '8px' }"
							v-for="(item, index) in radiolist1"
							:key="index"
							:label="item.name"
							:name="item.name"
							@change="radioChange"
						></u-radio>
					</u-radio-group>
				</view>
				<view class="flex-between1">
					<view class="btn1 flex-center1">取消</view>
					<view class="btn2 flex-center1">确定</view>
				</view>
			</view>
		</u-popup>
		<u-popup :show="show1" @close="close1" mode="center" round="20">
			<view class="pop" style="width: 560rpx; height: 496rpx; padding-top: 64rpx; background: url('../../static/index/bm.png') no-repeat; background-size: 100% 100%">
				<view class="flex-center1" style="margin-bottom: 30rpx">
					<image src="@/static/index/bm1.png" style="width: 168rpx; height: 152rpx"></image>
				</view>
				<view style="font-size: 32rpx; color: #333333; text-align: center; margin-bottom: 30rpx">添加成功</view>
				<view style="font-weight: 400; font-size: 28rpx; color: #999999; text-align: center">代投递通知已发送给劳动者</view>
			</view>
		</u-popup>
	</view>
</template>

<script>
export default {
	data() {
		return {
			show: false,
			show1: false,
			// 基本案列数据
			radiolist1: [
				{
					name: '苹果'
				},
				{
					name: '香蕉'
				},
				{
					name: '橙子'
				},
				{
					name: '榴莲'
				}
			],
			radiovalue1: '苹果',
			type: 0,
			pageNum: 1,
			pageSize: 20,
			isLastPage: false,
			list: [],
			id: '',
			obj: {}
		};
	},
	onLoad(option) {
		this.id = option.value;
		this.init();
		this.getdetail();
	},
	onReachBottom() {
		if (this.isLastPage) return;
		this.pageNum++;
		this.init();
	},
	methods: {
		init() {
			const data = {
				pageNum: this.pageNum,
				pageSize: this.pageSize,
				status: this.type
			};
			this.$request('front/company/myResume', data).then((res) => {
				this.list = [...this.list, ...res.obj.list];
				console.log(res.obj.list, '列表');
				this.isLastPage = res.obj.isLastPage;
			});
		},
		getdetail() {
			this.$request('front/user/postDetail', {
				id: this.id
			}).then((res) => {
				console.log(res, '详情');
				this.obj = res.obj;
				this.obj.projectImg.split(',')[0];
			});
		},
		addPostUser(id) {
			const data = {
				id,
				postId: this.id
			};
			this.$request('front/company/addPostUser', data).then((res) => {
				console.log(res, '详情');
				this.$tools.toast('操作成功');
				setTimeout(() => {
					this.list = [];
					this.init();
				}, 1000);
			});
		},
		close() {
			this.show = false;
			// console.log('close');
		},
		close1() {
			this.show1 = false;
			// console.log('close');
		},
		groupChange(n) {
			console.log('groupChange', n);
		},
		radioChange(n) {
			console.log('radioChange', n);
		}
	}
};
</script>

<style lang="less" scoped>
.myldz {
	padding-top: calc(var(--status-bar-height) + 180rpx);
	::v-deep .u-radio {
		padding: 34rpx 0;
		border-bottom: 1rpx solid #eeeeee;
		.u-radio__text {
			span {
				font-weight: 400;
				font-size: 28rpx;
				color: #333333;
			}
		}
	}
	.text1 {
		font-weight: 600;
		font-size: 28rpx;
		color: #1365f9;
	}
	.text2 {
		font-weight: 400;
		font-size: 28rpx;
		color: #999999;
	}
	.box {
		position: fixed;
		bottom: 100rpx;
		right: 32rpx;
	}
	.btn1 {
		width: 220rpx;
		height: 96rpx;
		background: #ffffff;
		border-radius: 8rpx;
		border: 2rpx solid #1365f9;
		font-size: 32rpx;
		color: #1365f9;
	}
	.btn2 {
		width: 426rpx;
		height: 96rpx;
		background: #1365f9;
		border-radius: 8rpx;
		font-size: 32rpx;
		color: #ffffff;
	}
}
</style>
